Optimal. Leaf size=87 \[ -\frac {\left (a^2 B+2 a A b-b^2 B\right ) \log (\cos (c+d x))}{d}+x \left (a^2 A-2 a b B-A b^2\right )+\frac {b (a B+A b) \tan (c+d x)}{d}+\frac {B (a+b \tan (c+d x))^2}{2 d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.08, antiderivative size = 87, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, integrand size = 23, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.130, Rules used = {3528, 3525, 3475} \[ -\frac {\left (a^2 B+2 a A b-b^2 B\right ) \log (\cos (c+d x))}{d}+x \left (a^2 A-2 a b B-A b^2\right )+\frac {b (a B+A b) \tan (c+d x)}{d}+\frac {B (a+b \tan (c+d x))^2}{2 d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3475
Rule 3525
Rule 3528
Rubi steps
\begin {align*} \int (a+b \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx &=\frac {B (a+b \tan (c+d x))^2}{2 d}+\int (a+b \tan (c+d x)) (a A-b B+(A b+a B) \tan (c+d x)) \, dx\\ &=\left (a^2 A-A b^2-2 a b B\right ) x+\frac {b (A b+a B) \tan (c+d x)}{d}+\frac {B (a+b \tan (c+d x))^2}{2 d}+\left (2 a A b+a^2 B-b^2 B\right ) \int \tan (c+d x) \, dx\\ &=\left (a^2 A-A b^2-2 a b B\right ) x-\frac {\left (2 a A b+a^2 B-b^2 B\right ) \log (\cos (c+d x))}{d}+\frac {b (A b+a B) \tan (c+d x)}{d}+\frac {B (a+b \tan (c+d x))^2}{2 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] time = 0.43, size = 96, normalized size = 1.10 \[ \frac {2 b (2 a B+A b) \tan (c+d x)+(a-i b)^2 (B+i A) \log (\tan (c+d x)+i)+(a+i b)^2 (B-i A) \log (-\tan (c+d x)+i)+b^2 B \tan ^2(c+d x)}{2 d} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 1.14, size = 91, normalized size = 1.05 \[ \frac {B b^{2} \tan \left (d x + c\right )^{2} + 2 \, {\left (A a^{2} - 2 \, B a b - A b^{2}\right )} d x - {\left (B a^{2} + 2 \, A a b - B b^{2}\right )} \log \left (\frac {1}{\tan \left (d x + c\right )^{2} + 1}\right ) + 2 \, {\left (2 \, B a b + A b^{2}\right )} \tan \left (d x + c\right )}{2 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [B] time = 0.95, size = 901, normalized size = 10.36 \[ \text {result too large to display} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.02, size = 151, normalized size = 1.74 \[ \frac {b^{2} B \left (\tan ^{2}\left (d x +c \right )\right )}{2 d}+\frac {A \tan \left (d x +c \right ) b^{2}}{d}+\frac {2 B \tan \left (d x +c \right ) a b}{d}+\frac {\ln \left (1+\tan ^{2}\left (d x +c \right )\right ) A a b}{d}+\frac {\ln \left (1+\tan ^{2}\left (d x +c \right )\right ) a^{2} B}{2 d}-\frac {\ln \left (1+\tan ^{2}\left (d x +c \right )\right ) b^{2} B}{2 d}+\frac {A \arctan \left (\tan \left (d x +c \right )\right ) a^{2}}{d}-\frac {A \arctan \left (\tan \left (d x +c \right )\right ) b^{2}}{d}-\frac {2 B \arctan \left (\tan \left (d x +c \right )\right ) a b}{d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 0.97, size = 91, normalized size = 1.05 \[ \frac {B b^{2} \tan \left (d x + c\right )^{2} + 2 \, {\left (A a^{2} - 2 \, B a b - A b^{2}\right )} {\left (d x + c\right )} + {\left (B a^{2} + 2 \, A a b - B b^{2}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 2 \, {\left (2 \, B a b + A b^{2}\right )} \tan \left (d x + c\right )}{2 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 6.23, size = 91, normalized size = 1.05 \[ \frac {\ln \left ({\mathrm {tan}\left (c+d\,x\right )}^2+1\right )\,\left (\frac {B\,a^2}{2}+A\,a\,b-\frac {B\,b^2}{2}\right )}{d}-x\,\left (-A\,a^2+2\,B\,a\,b+A\,b^2\right )+\frac {\mathrm {tan}\left (c+d\,x\right )\,\left (A\,b^2+2\,B\,a\,b\right )}{d}+\frac {B\,b^2\,{\mathrm {tan}\left (c+d\,x\right )}^2}{2\,d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [A] time = 0.30, size = 143, normalized size = 1.64 \[ \begin {cases} A a^{2} x + \frac {A a b \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{d} - A b^{2} x + \frac {A b^{2} \tan {\left (c + d x \right )}}{d} + \frac {B a^{2} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} - 2 B a b x + \frac {2 B a b \tan {\left (c + d x \right )}}{d} - \frac {B b^{2} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {B b^{2} \tan ^{2}{\left (c + d x \right )}}{2 d} & \text {for}\: d \neq 0 \\x \left (A + B \tan {\relax (c )}\right ) \left (a + b \tan {\relax (c )}\right )^{2} & \text {otherwise} \end {cases} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________